package load;

import java.util.ArrayList;

/**
 * @Author admin
 * @Date 2019/3/29 10:33
 */
public class UserDaoImp implements UserDao {
    ArrayList arrayList=new ArrayList();
    ArrayList arrayList1=new ArrayList();

    @Override
    public void regist(User user) {
        arrayList.add(user.getUserName());
        arrayList1.add(user.getPassword());
        System.out.println("注册成功！");
    }

    @Override
    public boolean login(String name, String password) {
        for (int i=0;i<arrayList.size();i++){
            if (arrayList.get(i).equals(name)&arrayList1.get(i).equals(password)){
                return true;
            }
        }
        return false;
    }
    int b = (int) (Math.random()*100);
    public boolean guess(int a){
        if (a>b){
            System.out.println("你猜的数据"+a+"大了");
            return false;
        }
        else if (a<b){
            System.out.println("你猜的数据"+a+"小了");
            return false;
        }
        else{
            System.out.println("恭喜你，猜中了");
            return true;
        }
    }

}
